Click here to Skip to main content
15,888,037 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
JokeI got pulled over driving in the HOV lane... PinPopular
Mike Hankey2-Jul-20 7:14
mveMike Hankey2-Jul-20 7:14 
GeneralRe: I got pulled over driving in the HOV lane... Pin
ZurdoDev2-Jul-20 8:18
professionalZurdoDev2-Jul-20 8:18 
GeneralRe: I got pulled over driving in the HOV lane... Pin
Mike Hankey2-Jul-20 8:21
mveMike Hankey2-Jul-20 8:21 
GeneralRe: I got pulled over driving in the HOV lane... Pin
OriginalGriff2-Jul-20 8:40
mveOriginalGriff2-Jul-20 8:40 
GeneralRe: I got pulled over driving in the HOV lane... Pin
theoldfool2-Jul-20 15:14
professionaltheoldfool2-Jul-20 15:14 
GeneralRe: I got pulled over driving in the HOV lane... Pin
DRHuff2-Jul-20 18:31
DRHuff2-Jul-20 18:31 
GeneralRe: I got pulled over driving in the HOV lane... Pin
enhzflep3-Jul-20 2:27
enhzflep3-Jul-20 2:27 
GeneralApparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 5:47
mvahoney the codewitch2-Jul-20 5:47 
No amount of caffeine is getting me through my morning, and I've found a bug in my MidiSlicer app. It's not a show stopper, but it's annoying. There are two ways to fix it, and one way is a dastardly hack. The other is complicated, but the Proper Way(TM) to do things.

The problem is such: In the MidiSlicer app you can modify a file while it is playing. However, since playback merges all of the tracks together for playback since they all must play at once, if you "mute" a track by removing it from playback, it changes the number of "events" in the stream. So your current cursor position during playback is now invalid.

Say for example we're playing a track with the following layouts
Drums: 50 events
Bass: 35 events
Guitar: 60 events

Total that's 145 events. So let's say I'm playing back and I'm near the end of the loop, and I remove the bass track. Well I'm on position 140, but it doesn't exist anymore now, because there are only 110 events in the stream now. Make sense?

The dumb way to fix it: Add a "dummy" NOP midi message to the API that never gets played or saved to disk. Replace any events i remove with a dummy event.

The right way to fix it: Before modification, get the absolute time of the cursor position. This should be expressed basically as system ticks or a timespan. After modifying the events, seek back within the event stream to that same *time* based position, wrapping if needed. and get the actual position within the event stream from that.

The latter way is preferable for many reasons, but while I've written code to convert from the current position to an absolute time based position, I do not have the code to go the other way around.

It sounds like a simple computation of time - basically the time each quarternote takes in system ticks, and then measure the score as quarter notes - which is simplified from what i'm actually doing but close. However, it won't work because the tempo can change throughout the track, meaning the duration of a quarter note can change throughout the score.

Measuring it involves starting at 0 and moving through the track, counting up times at the current tempo, and then recomputing durations whenever the tempo changes. That's what I do going the first direction. Converting from Time to position should be roughly the same thing but my brain isn't working this morning.
Real programmers use butterflies

GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
Nelek2-Jul-20 7:41
protectorNelek2-Jul-20 7:41 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 7:42
mvahoney the codewitch2-Jul-20 7:42 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
David O'Neil2-Jul-20 7:48
professionalDavid O'Neil2-Jul-20 7:48 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 8:52
mvahoney the codewitch2-Jul-20 8:52 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
David O'Neil2-Jul-20 9:00
professionalDavid O'Neil2-Jul-20 9:00 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 9:03
mvahoney the codewitch2-Jul-20 9:03 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
Greg Utas2-Jul-20 9:18
professionalGreg Utas2-Jul-20 9:18 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 9:27
mvahoney the codewitch2-Jul-20 9:27 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 9:28
mvahoney the codewitch2-Jul-20 9:28 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
David O'Neil2-Jul-20 9:31
professionalDavid O'Neil2-Jul-20 9:31 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 9:35
mvahoney the codewitch2-Jul-20 9:35 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
David O'Neil2-Jul-20 10:15
professionalDavid O'Neil2-Jul-20 10:15 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
honey the codewitch2-Jul-20 12:23
mvahoney the codewitch2-Jul-20 12:23 
GeneralRe: Apparently there's not enough coffee in the world for me right now. Pin
David O'Neil2-Jul-20 12:59
professionalDavid O'Neil2-Jul-20 12:59 
GeneralThought of the Day Pin
OriginalGriff2-Jul-20 4:29
mveOriginalGriff2-Jul-20 4:29 
GeneralRe: Thought of the Day Pin
W Balboos, GHB2-Jul-20 4:32
W Balboos, GHB2-Jul-20 4:32 
GeneralRe: Thought of the Day Pin
OriginalGriff2-Jul-20 4:54
mveOriginalGriff2-Jul-20 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.